const BASE_URL = "https://e165aa6b-82cb-4085-bc0d-5a205c1097c6.bspapp.com/http"

const request = (options) => {
	const {
		path = '', method = "GET", data = {}, headers = {}
	} = options;

	return new Promise((resolve, reject) => {

		uni.request({
			url: BASE_URL + path,
			method: method,
			data: data,
			header: headers,
			success(res) {
				uni.hideLoading();
				uni.stopPullDownRefresh();
				resolve(res);
			},
			fail(err) {
				uni.hideLoading();
				uni.stopPullDownRefresh();
				reject(err);
			}
		})

	})

}

export default request;
